-
Notifications
You must be signed in to change notification settings - Fork 111
Wrap agent log rendering in collapsible details section #14208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add wrapAgentLogInSection function to log_parser_shared.cjs - Update log_parser_bootstrap.cjs to wrap agent logs in details/summary - Add comprehensive tests for the new wrapper function - Update existing tests to expect wrapped output - All JavaScript tests passing Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR updates the GitHub Actions log rendering pipeline so agent markdown logs are wrapped in an HTML <details open> block with a standardized summary label (🤖 {Parser} CLI Session), improving readability in step summaries and safe-output issue bodies.
Changes:
- Added
wrapAgentLogInSection()helper to wrap agent log markdown in a collapsible<details>section. - Updated
log_parser_bootstrap.cjsto apply wrapping for both Copilot CLI-style summaries and the fallback markdown output path. - Updated/added tests to validate wrapper behavior and adjust bootstrap expectations.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| actions/setup/js/log_parser_shared.cjs | Introduces wrapAgentLogInSection() and exports it for use in bootstrap. |
| actions/setup/js/log_parser_bootstrap.cjs | Wraps step-summary markdown output using the new wrapper function. |
| actions/setup/js/log_parser_shared.test.cjs | Adds unit tests for wrapper behavior. |
| actions/setup/js/log_parser_bootstrap.test.cjs | Updates expectations to match wrapped step-summary output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const openAttr = open ? " open" : ""; | ||
| const emoji = "🤖"; | ||
| const title = `${emoji} ${parserName} CLI Session`; | ||
|
|
||
| return `<details${openAttr}>\n<summary>${title}</summary>\n\n${markdown}\n</details>`; |
Copilot
AI
Feb 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parserName is interpolated directly into the <summary> HTML without escaping. If it ever contains characters like <, &, or ", it can break the rendered markup (and potentially allow HTML injection in step summaries/issue bodies). Please HTML-escape parserName (and/or the computed title) before embedding it in the <summary> tag.
| // Wrap the agent log in a details/summary section (open by default) | ||
| const wrappedAgentLog = wrapAgentLogInSection(copilotCliStyleMarkdown, { | ||
| parserName, | ||
| open: true, | ||
| }); | ||
|
|
||
| // Add safe outputs preview to step summary | ||
| let fullMarkdown = copilotCliStyleMarkdown; | ||
| let fullMarkdown = wrappedAgentLog; |
Copilot
AI
Feb 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wrapping is applied for the main parsed-markdown paths, but the earlier Copilot conversation.md fast-path still writes result.markdown directly to the step summary (unwrapped). That means Copilot --share output won’t get the collapsible section even though other paths do. Consider wrapping that path too (or update the PR description/behavior to be consistent).
| it("should properly escape markdown content", async () => { | ||
| const { wrapAgentLogInSection } = await import("./log_parser_shared.cjs"); | ||
|
|
||
| const markdown = "Content with <tags> and `code`"; | ||
| const result = wrapAgentLogInSection(markdown, { parserName: "Copilot" }); | ||
|
|
||
| expect(result).toContain(markdown); | ||
| expect(result).toContain("<details open>"); | ||
| expect(result).toContain("</details>"); | ||
| }); |
Copilot
AI
Feb 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test claims the wrapper “properly escape[s] markdown content”, but wrapAgentLogInSection currently injects markdown verbatim and the assertions only check that the raw string is present. Either update the test name/expectations, or implement escaping/sanitization if the intent is to render <tags> literally rather than as HTML.
| const { wrapAgentLogInSection } = await import("./log_parser_shared.cjs"); | ||
|
|
||
| expect(wrapAgentLogInSection("")).toBe(""); | ||
| expect(wrapAgentLogInSection(" ")).toBe(""); |
Copilot
AI
Feb 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test name says it covers “undefined markdown”, but it never calls wrapAgentLogInSection(undefined). Add an explicit undefined case or adjust the test description to match what’s being tested.
| expect(wrapAgentLogInSection(" ")).toBe(""); | |
| expect(wrapAgentLogInSection(" ")).toBe(""); | |
| expect(wrapAgentLogInSection(undefined)).toBe(""); |
Agent markdown logs now render wrapped in HTML
<details>sections with the format🤖 {Parser} CLI Session, open by default.Changes
Added
wrapAgentLogInSection()inlog_parser_shared.cjs<details open>with customizable parser nameUpdated
log_parser_bootstrap.cjsTest updates
Example
Before:
After:
Applies to GitHub Actions step summaries and safe-output issue bodies.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.